<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
    <title><{config_item('manager_title')}></title>
    <link href="/public/H-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="/public/H-ui/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="/public/H-ui/hui-iconfont/iconfont.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="pd-20">
	<form action="<{site_url('/manager/goods/brand/save')}>" method="post" class="form form-horizontal" id="add">
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red">*</span>品牌名称：</label>
			<div class="formControls col-5">
				<input type="text" class="input-text" value="" name="name" datatype="*" nullmsg="请输入品牌名称！">
			</div>
		</div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red">*</span>品牌logo：</label>
            <div class="formControls col-6">
                <a href="<{$item.logo}>" target="_blank"><img src="<{$item.logo}>" width="50" <{if $item.logo==''}>style="display: none;"<{/if}>></a>
                <input type="hidden" value="" name="logo">
                <input type="file" name="logo_pic" id="logo_pic" onchange="upload_file(this);" style="width: 150px;">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red">*</span>所属分类：</label>
            <div class="formControls col-5">
                <span class="select-box" style="height: 150px;">
				<select name="cat_id[]" class="select" multiple style="height: 140px;">
                    <option value="">请选择分类(可多选)</option>
                    <!--分类模板-->
                    <{function name=type level=0}>
                    <{foreach $data as $key}>
                    <option value="<{$key.id}>" <{if in_array($key.id,$item.cat_id)}>selected<{/if}>><{section name=loop loop=$level}>├<{/section}><{$key.name}></option>
                    <{call name=type data=$key.down level=$level+1}>
                    <{/foreach}>
                    <{/function}>
                    <!--调用模板函数-->
                    <{call name=type data=$cat_list}>
                </select>
				</span>
            </div>
        </div>
		<div class="row cl">
			<label class="form-label col-3">排序值：</label>
			<div class="formControls col-5">
				<input type="text" class="input-text" value="99" name="sortnum" datatype="n" nullmsg="请输入排序值！" errormsg="排序值只能是数字">
			</div>
		</div>
		<div class="row cl">
			<div class="col-10 col-offset-2">
                <input type="hidden" name="id" value="">
				<button onClick="$('#add').submit();" class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
				<button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
			</div>
		</div>
	</form>
</div>
</div>
<script type="text/javascript" src="/public/js/jquery.js"></script>
<script type="text/javascript" src="/public/js/validform.js"></script>
<script type="text/javascript" src="/public/js/layer/layer.js"></script>
<script type="text/javascript" src="/public/js/form.js"></script>
<script type="text/javascript" src="/public/H-ui/js/H-ui.js"></script>
<script type="text/javascript" src="/public/H-ui/js/H-ui.admin.js"></script>
<{ajax_upload()}>
<script type="text/javascript">
    $(function(){
        //验证表单
        $.Tipmsg.r=null;
        $("#add").Validform({
            tiptype:function(msg){
                layer.msg(msg);
            },
            tipSweep:true,
            ajaxPost:true,
            callback:function(data){
                if(data.status=="y"){
                    layer_close();
                }
            }
        });
        //表单回填
        var formObj = new Form();
        formObj.init(<{ch_json_encode($item)}>);
    })
    //添加图片展示
    function show_upload(spec_pic, url){
        $("#"+spec_pic).parent().find('img').attr('src',url);
        $("#"+spec_pic).parent().find('img').show();
        $("#"+spec_pic).parent().find('a').attr('href',url);
        $("#"+spec_pic).parent().find('[type="hidden"]').val(url);
    }
</script>
</body>
</html>